import {defineStore} from 'pinia'

export const useAttrStore = defineStore('a_attr', {
    state:()=>({
        // 所有这些属性都将自动推断其类型
        u_a_attr: {}||uni.getStorageSync("u_a_attr"),
    }),
    getters: {
        getAttrInfo: (state) => {
            if (state.u_a_attr['articleTitle']){
                return state.u_a_attr
            }else {
                return uni.getStorageSync("u_a_attr")
            }
        }
    },
    actions:{
        saveAttrInfo(attr){
            //持久化操作
            uni.setStorageSync("u_a_attr",attr)
            this.u_a_attr = attr
        }
    },
    persist: {
        enabled: true
    },

})